<template>
  <view>
    <!-- 公共组件-每个页面必须引入 -->
    <public-module></public-module>
		<view class="u-padding-20">
		<u--form labelPosition="left" labelWidth="80" >
			<u-form-item label="来源商店ID" >
				<u-input placeholder="请输入商店ID编号,可从该商家介绍中找到" type="text" v-model="importshopid"/>
			</u-form-item>
		</u--form>
		<view class="u-flex u-flex-start u-flex-fill">
			<view class="u-flex-8">
				<u-button type="primary" @click="import_goods()">一键(导入/更新)商品</u-button>
			</view>
			<view class="u-flex-4 u-m-l-20">
				<u-button type="error" @click="delete_goods()">一键清除商品</u-button>
			</view>
			
		</view>
		</view>
		<view class="b-b"></view>
        <view class="base-tonglan-box u-m-b-30">
          <view class="item">
			  <b>一键(导入/更新)商品：</b><br>请输入您代理的商店的 ID，然后一键导入。代理的商品只需设置销售价格(如已导入的产品再次导入不会影响您设置的新的产品价格)，其他的信息上级商家在修改时会同步更新。
          </view>
		  <view class="item">
			  <b>一键清除商品：</b><br>移除代理的商店 ID 下的所有商品。
		  </view>
        </view>
		<view class="b-b"></view>

	
  </view>
</template>


<script>
import { mapState, mapMutations } from "vuex";
import { api_content_info,api_accord_info } from '@/config/api.js';
export default {
  data() {
    return {
      hasLogin: false,
      loadStatus: "loadmore",
      loadstatus: false,
	  importshopid:'',
	  shop_id:''
    };
  },

   onLoad(options) {
	 let query = JSON.parse(decodeURIComponent(options.query));
	 this.shop_id = query.shop_id;

  },
  methods: {
		import_goods(){
				this.$api('shopstore.import_goods', {
					importshopid:this.importshopid,
					shop_id:this.shop_id
				}).then(res => {
					console.log(res)
					this.$tools.msg(res.msg)
				}).catch((e)=>{});
		},
		delete_goods(){
				this.$api('shopstore.del_import_goods', {
					importshopid:this.importshopid,
					shop_id:this.shop_id
				}).then(res => {
					this.$tools.msg(res.msg)
				}).catch((e)=>{});
		},
  },
};
</script>
<style lang="scss" scoped>
</style>
